import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String hexInput = in.nextLine();
        decode(hexInput);
    }
    private static void decode(String hexInput){
        byte[] bytes = hexStringToByteArray(hexInput);
        List<String> output = new ArrayList<>();
        int index = 0;
        while(index < bytes.length){
            if(index + 3 > bytes.length) break;

            int pro = bytes[index] & 0xFF;
            int msg = bytes[index + 1] & 0xFF;
            int total = 2 + msg;
            if(index + total > bytes.length) break;

            StringBuilder ms = new StringBuilder();
            for(int i = 2;i<total;i++){
                ms.append((char)bytes[index+i]);
            }
            output.add(pro + " " + ms.toString().trim());
            index += total;
        }
        for(String line : output){
            System.out.println(line);
        }
    }
    private static byte[] hexStringToByteArray(String s){
        int len = s.length();
        byte[] data = new byte[len/2];
        for(int i = 0;i<len;i+=2){
            data[i/2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
             + Character.digit(s.charAt(i+1), 16));
        }
        return data;
    }
}



